The present invention relates to data processing systems, and, more particularly, to methods, systems, and computer program products for managing memory usage in a data processing system.
Operating systems, such as the Java operating system developed by Sun Microsystems of Mountain View, Calif., may manage the use of a memory through use of a heap. The Java operating system, for example, may use both a static heap and a dynamic heap. The static heap may be a portion of memory that is allocated before applications execute. Memory from the static heap may then be allocated to store objects and other runtime data that the applications need. Unfortunately, to determine how much memory to assign to the static heap, it is necessary to estimate how much memory the applications may need, which may be very difficult. For this reason, a static heap may be engineered conservatively with more memory being allocated to the static heap that is typically necessary. This may result in wasted memory when applications do not require as much memory as has been engineered into a static heap. Static heaps do offer advantages, however, in being relatively simple to implement and in providing generally good reliability.
A dynamic heap approach is based on more advanced heap management technology. In a dynamic heap, a memory manager allocates an initial block of memory for the dynamic heap and, if this memory is insufficient to meet the needs of the applications, then additional memory blocks may be allocated to dynamic heap for use by the applications. Management of a dynamic heap involves garbage collection, which refers to the recycling of dynamically allocated memory, and compaction. Thus, while a dynamic heap may provide relatively efficient use of memory, management of a dynamic heap is generally more complex than management of a static heap.